package com.fdb.efp.nls.service.impl.sx.zxruleforbd;

import com.fdb.cdp.pboc.service.vo.BdZxInfoVO;
import com.fdb.efp.rule.service.vo.ReqBdCreditRuleVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.stream.Stream;

/**
 * 贷款五级分类为“次级”,可疑，“损失”任意一笔贷款 <br>
 * <p>
 * 0.1:caoxin:2019/7/10 17:03: <br>
 * @author caoxin
 * @version 0.1
 * @date 2019/7/10 17:03
 * @since 2019/7/10 17:03
 */
@Service("bDZxRule07")
public class BDZxRule07 implements BdZxRuleInterface{
    @Override
    public void executeRule(ReqBdCreditRuleVo reqBdCreditRuleVo,BdZxInfoVO bdZxInfoVO) {
        Integer sum = Stream.of(bdZxInfoVO.getZxCreCardStatus4()).filter(StringUtils::isNotEmpty).filter(t -> {
            return "次级".equals(t) || "可疑".equals(t) || "损失".equals(t);
        }).map(e -> 1).reduce(0, Integer::sum);
        reqBdCreditRuleVo.setRule07(sum);
    }
}
